package role

import (
	"context"
	"jinrigaoping/api/platform/internal/svc"
	"jinrigaoping/api/platform/internal/types"
	"jinrigaoping/rpc/sys/sys"

	"github.com/zeromicro/go-zero/core/logx"
)

type RoleDeleteLogic struct {
	logx.Logger
	ctx    context.Context
	svcCtx *svc.ServiceContext
}

func NewRoleDeleteLogic(ctx context.Context, svcCtx *svc.ServiceContext) *RoleDeleteLogic {
	return &RoleDeleteLogic{
		Logger: logx.WithContext(ctx),
		ctx:    ctx,
		svcCtx: svcCtx,
	}
}

func (l *RoleDeleteLogic) RoleDelete(req *types.SysRoleDeleteReq) (resp *types.SysRoleDeleteRes, err error) {

	if _, err := l.svcCtx.SysRpc.SysRoleDelete(l.ctx, &sys.SysRoleDeleteReq{Id: req.Id}); err != nil {
		return nil, err
	}

	return &types.SysRoleDeleteRes{}, nil
}
